package org.bluedream.core.module.sys.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import org.bluedream.comm.base.PageEntity;
import java.util.Date;
import java.util.List;

@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@TableName(value = "sys_user")
public class User extends PageEntity<User> {
    private static final long serialVersionUID = -607114624589159578L;

    @NonNull
    private String loginCode;
    @NonNull
    private String userName;
    @NonNull
    private String password;
    private String email;
    private String mobile;
    private String phone;
    private String sex;
    private String avatar;
    private String sign;
    @TableField(value = "WX_OPENID")
    private String wxOpenId;
    private String userType;
    private String refCode;
    private String refName;
    private String mgrType;
    private Integer pwdSecurityLevel;
    private Date pwdUpdateDate;
    private String pwdUpdateRecord;
    private String pwdQuestion;
    private String pwdQuestionAnswer;
    private Date pwdQuestUpdateDate;
    private String lastLoginIp;
    private String lastLoginDate;
    private Date freezeDate;
    private String freezeCause;
    private Integer userWeight;
    protected String orgCode;

    @TableField(exist = false)
    @Setter
    @Getter
    private List<Organization> organizations;

    @TableField(exist = false)
    @Setter
    @Getter
    private List<Role> roles;

    public User(long limit , long pageSize) {
        this.limit = limit;
        this.page = pageSize;
    }

    public User(String id){
        this.id = id;
    }
}
